let log4js = require('../logger');
module.exports = {
    env: 'test', //环境名称
    port: 3002, //服务端口号
    core: {
        origin: function (ctx) {
            if (ctx.url == '/tes/*') {
                //这样就能只允许 http://localhost:8080 这个域名的请求了
                return 'http://localhost:8080';
            }
            return "*"; // 允许来自所有域名请求
        },
        exposeHeaders: ['WWW-Authenticate', 'Server-Authorization', 'USER_TOKEN'],
        maxAge: 5,
        credentials: true,
        allowMethods: ['GET', 'POST', 'DELETE', 'OPTIONS', 'PUT'],
        allowHeaders: ['Content-Type', 'Authorization', 'Accept'],
    },
    mongodb: {
        uri: 'mongodb://127.0.0.1:27017/book-case',
        db: 'BookCase',
    },
    auth: {
        access_key: "access_token",
        access_token: 'fsfsfsf3434fuerfsfnlfsjfsfsfgdgdgdgd&fdfdlfldf',
        salt: 'fsfsfsf3434fuerfsfnlfsjfsfsfgdgdgdgd&fdfdlfldf',
        wechatTtl: 3600 * 24 * 7,
        adminTtl: 3600 * 2,
        wechatLoginPrefix: "wechat:user:openid:",
        adminLoginPrefix: "admin:user:info:"
    },
    logger: {
        accessLogger: () => log4js.koaLogger(log4js.getLogger('out')),
        infoLogger: log4js.getLogger('out'),
        errorLogger: log4js.getLogger('out'),
        //infoLogger: log4js.getLogger('applicationInfo'),
        //errorLogger: log4js.getLogger('applicationError'),
        con: log4js.getLogger('out')
    },
    redis: {
        port: 6379,          // Redis port
        host: '127.0.0.1',   // Redis host
        //prefix: 'tb-ski:', //存诸前缀
        //ttl: 60 * 60 * 23,  //过期时间
        //family: 4,
        password: null,
        db: 0
    },
    wechat: {
        appId: 'wx015a1c2df4282b80',
        secret: '1952ca8e77d01777d0d2925e10d97b81',
        tokenKey: 'wechat:access:token:',
        expire: 7200,
    }
};
